<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app"></div>
    <template id="t1">
      <div>
        <template v-for="user in users">
          <h2 :key="user.name+'a'">{{user.name}}</h2>
          <p :key="user.name+'b'">{{user.age}}-{{user.gender}}</p>
        </template>
      </div>
    </template>
    <script src="./vue.js"></script>
    <script>
      /*
      1. 如果要创建多个同级标签的时候，可以使用 template 作为容器包裹
      2. key 值是不能写在 template 标签上，必须写在template 包裹的标签里
      */
      const vm = new Vue({
        el: "#app",
        template: "#t1",
        data: {
          users: [
            { name: "jack", age: 20, gender: 1 },
            { name: "lili", age: 21, gender: 2 },
            { name: "lucy", age: 18, gender: 2 },
            { name: "tom", age: 19, gender: 1 },
          ],
        },
        methods: {},
      });
    </script>
  </body>
</html>
